package com.example.ole.taskqueue;

import android.app.Activity;
import android.os.Bundle;
import android.os.SystemClock;


import com.example.ole.taskqueue.Q.base.XTask;
import com.example.ole.taskqueue.Q.base.XTaskQueue;
import com.example.ole.taskqueue.Q.recording.RecordingTask;
import com.example.ole.taskqueue.Q.recording.RecordingTaskQueue;


public class MainActivity extends Activity {

    private static final String TAG = "test";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        RecordingTaskQueue rtq = new RecordingTaskQueue(1);
        rtq.start();
        rtq.addTask(new RecordingTask(0));
        rtq.addTask(new RecordingTask(0));
        SystemClock.sleep(2000);
        rtq.addTask(new RecordingTask(1));
        // Test Stop()
        // SystemClock.sleep(2000);
        // rtq.stop(true, 1000);
        rtq.addTask(new RecordingTask(2));
        rtq.addTask(new RecordingTask(0));

        SystemClock.sleep(3000);
        rtq.addTask(new RecordingTask(0));// Test queue full reject.

        SystemClock.sleep(30000);
        rtq.stop(false, 1000);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
